package org.grapes.wine.api.server.util.hibernate;

import java.util.EnumSet;

import org.grapes.wine.api.server.exception.MethodErrorCode;
import org.grapes.wine.api.server.exception.MethodException;
import org.grapes.wine.api.server.model.IDAO;

@Deprecated
public class HibernateHelper {

	public static final HibernateOperateState State = null;

	private HibernateOperateState operateState;

	private IDAO dao;

	private String hql;
	
	public HibernateHelper(IDAO dao, HibernateOperateState state) throws MethodException {
		if (operateState != null
				&& !EnumSet.allOf(HibernateOperateState.class).contains(state)) {
			this.operateState = state;
		} else {
			throw new MethodException(MethodErrorCode.HIBERNATE_STATE_ERROR);
		}
		this.dao = dao;
	}

	public HibernateOperateState getOperateState() {
		return operateState;
	}

	public void setOperateState(HibernateOperateState operateState) {
		this.operateState = operateState;
	}

	public IDAO getDao() {
		return dao;
	}

	public void setDao(IDAO dao) {
		this.dao = dao;
	}

	public String getHql() {
		return hql;
	}

	public void setHql(String hql) {
		this.hql = hql;
	}

	public static HibernateOperateState getState() {
		return State;
	}
}
